<?php
$this->breadcrumbs = array(
	'Employees'=>array('index'),
	$model->name,
);
?>

<h1><?php echo $model->name; ?></h1>

<div>
	<?php
	$properties = array(
		'items'=>$model->getMenu($this->action->id, true),
		'htmlOptions'=>array(
			'class'=>'operations',
		),
		'encodeLabel'=>false,
	);
	$this->widget('zii.widgets.CMenu', $properties);
	?>
</div>

<hr />

<table class="collapse">
	<tr>
		<td class="top">
			<?php
			$src = $model->photoBehavior->getFileUrl('thumb');
			$alt = 'Photo';
			$htmlOptions = array(
				'class'=>'stroke round column',
			);
			echo CHtml::image($src, $alt, $htmlOptions);
			?>
		</td>
		<td class="full">
			<?php
			$workAt = CHtml::encode($model->workAt);
			if ($model->workLocation) {
				$workAt .= '. ';
				$workAt .= CHtml::encode($model->workLocation);
			}

			$this->widget('zii.widgets.CDetailView',
				array(
				'data'=>$model,
				'attributes'=>array(
					'name',
					'code',
					'gender',
					'matrimony',
					array(
						'type'=>'date',
						'name'=>'unixBirthDate',
					),
					'employmentStatus',
					array(
						'type'=>'date',
						'name'=>'unixEmploymentDate',
					),
					array(
						'type'=>'date',
						'name'=>'unixExpiredDate',
					),
					array(
						'type'=>'date',
						'name'=>'unixUnemploymentDate',
					),
					'position',
					'division',
					'group',
					'supervisor.name',
					array(
						'name'=>'address',
						'type'=>'ntext',
					),
					array(
						'name'=>'email',
						'type'=>'email',
					),
					array(
						'label'=>$model->getAttributeLabel('workAt'),
						'type'=>'raw',
						'value'=>$workAt,
					),
					'leaveBalanceDefault',
					'leaveBalance',
				),
			));
			?>
		</td>
	</tr>
</table>

<p></p>

<?php
$view = 'Yii::app()->createUrl("identity/view", array("id"=>$data->id))';
$update = 'Yii::app()->createUrl("identity/update", array("id"=>$data->id))';
$properties = array(
	'dataProvider'=>$model->getDataProvider('identities'),
	'columns'=>array(
		'name',
		'code',
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view} {update}',
			'buttons'=>array(
				'view'=>array(
					'url'=>$view,
				),
				'update'=>array(
					'url'=>$update,
				),
			),
		),
	),
);
$identities = $this->widget('zii.widgets.grid.CGridView', $properties, true);

$view = 'Yii::app()->createUrl("insurance/view", array("id"=>$data->id))';
$update = 'Yii::app()->createUrl("insurance/update", array("id"=>$data->id))';
$properties = array(
	'dataProvider'=>$model->getDataProvider('insurances'),
	'columns'=>array(
		'name',
		'code',
		array(
			'name'=>'unixValidFrom',
			'type'=>'date',
			'header'=>$model->getAttributeLabel('validFrom'),
		),
		array(
			'name'=>'unixValidUntil',
			'type'=>'date',
			'header'=>$model->getAttributeLabel('validUntil'),
		),
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view} {update}',
			'buttons'=>array(
				'view'=>array(
					'url'=>$view,
				),
				'update'=>array(
					'url'=>$update,
				),
			),
		),
	),
);
$insurances = $this->widget('zii.widgets.grid.CGridView', $properties, true);

$view = 'Yii::app()->createUrl("family/view", array("id"=>$data->id))';
$update = 'Yii::app()->createUrl("family/update", array("id"=>$data->id))';
$properties = array(
	'dataProvider'=>$model->getDataProvider('families'),
	'columns'=>array(
		'name',
		'gender',
		'relation',
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view} {update}',
			'buttons'=>array(
				'view'=>array(
					'url'=>$view,
				),
				'update'=>array(
					'url'=>$update,
				),
			),
		),
	),
);
$families = $this->widget('zii.widgets.grid.CGridView', $properties, true);

$view = 'Yii::app()->createUrl("bank/view", array("id"=>$data->id))';
$update = 'Yii::app()->createUrl("bank/update", array("id"=>$data->id))';
$properties = array(
	'dataProvider'=>$model->getDataProvider('banks'),
	'columns'=>array(
		'name',
		'branch',
		'code',
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view} {update}',
			'buttons'=>array(
				'view'=>array(
					'url'=>$view,
				),
				'update'=>array(
					'url'=>$update,
				),
			),
		),
	),
);
$banks = $this->widget('zii.widgets.grid.CGridView', $properties, true);

$view = 'Yii::app()->createUrl("leave/view", array("id"=>$data->id))';
$update = 'Yii::app()->createUrl("leave/update", array("id"=>$data->id))';
$properties = array(
	'dataProvider'=>$model->getDataProvider('leaves'),
	'columns'=>array(
		array(
			'header'=>$model->getAttributeLabel('start'),
			'name'=>'unixStart',
			'type'=>'date',
		),
		'debit',
		'name',
		'status',
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view} {update}',
			'buttons'=>array(
				'view'=>array(
					'url'=>$view,
				),
				'update'=>array(
					'url'=>$update,
				),
			),
		),
	),
);
$leaves = $this->widget('zii.widgets.grid.CGridView', $properties, true);

$this->widget('zii.widgets.jui.CJuiTabs',
	array(
	'tabs'=>array(
		'Identities'=>array('id'=>'Identities', 'content'=>$identities),
		'Insurances'=>array('id'=>'Insurances', 'content'=>$insurances),
		'Families'=>array('id'=>'Families', 'content'=>$families),
		'Banks'=>array('id'=>'Banks', 'content'=>$banks),
		'Leaves'=>array('id'=>'Leaves', 'content'=>$leaves),
	),
	'options'=>array(
		'collapsible'=>true,
	),
));
?>